package com.mobilepay.moneypig.db;

import com.mobilepay.moneypig.config.DIR;
import com.mobilepay.moneypig.db.dbapi.DbManager;

import java.io.File;

/**
 * Created by xlm on 2017/7/17 0017
 */

public class DLDBManager {
    public static final String DBDIR = DIR.DB;
    public static final String DBNAME = "moneypig.db";
    public static final int DBVERSION = 1;
    private static DbManager mDB;

    public static DbManager getInstance() {
        if(mDB==null){
            File dir = new File(DBDIR);
            if (!dir.exists()) {
                dir.mkdirs();
            }
            mDB = DbUtil.getDb(dir, DBNAME, DBVERSION, new DbManager.DbUpgradeListener() {
                @Override
                public void onUpgrade(DbManager db, int oldVersion, int newVersion) {

                }
            });
        }
        return mDB;
    }
}
